package net.chathu.airgw.packets.chat 
{
	import net.chathu.airgw.model.Room;
	import net.chathu.airgw.util.StringUtil;
	/**
	 * ...
	 * @author ze
	 */
	public class ItemsConfRooms extends ChatPacket
	{
		
		public function ItemsConfRooms() 
		{
			
		}
		
		override public function execute():void
		{

			/*
			 * A konferenciaszobak listajat kuldte a szerver
			 */
			var channel_id:int,invite_id:int,usernum:int,modnum:int;
			var channel_name:String, topic:String;
			
			var j:int=3;
			while (j + 2 < data.length)
			{
				try {
					
					channel_id=parseInt(data[j]);
					invite_id=parseInt(data[j+7]);
					topic = StringUtil.convertFromISO88591(data[j + 5]);
					channel_name = topic;
					usernum=parseInt(data[j+3]);
					modnum=0;
					var room:Room = new Room(channel_id, invite_id, channel_name, topic, usernum, modnum, true, false)
					sessionData.chatData.rooms.add(room);
					
				}catch(err:Error) {
					trace(err.message);
				}
				j+=10;
			}
			//trace("#Num. of rooms:" +sessionData.chatData.rooms.getRoomNum());
		}
		
	}

}